<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>找回密码</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f4f7fc;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        .container {
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            padding: 30px;
            width: 100%;
            max-width: 450px;
        }

        h1 {
            font-size: 28px;
            text-align: center;
            color: #333;
            margin-bottom: 20px;
        }

        label {
            font-size: 16px;
            margin-bottom: 8px;
            display: block;
            color: #555;
        }

        input[type="email"],
        input[type="password"],
        input[type="text"],
        select {
            width: 100%;
            padding: 10px;
            margin-bottom: 15px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 16px;
        }

        button[type="submit"] {
            width: 100%;
            padding: 12px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        button[type="submit"]:hover {
            background-color: #45a049;
        }

        .error {
            background-color: #f8d7da;
            color: #721c24;
            padding: 15px;
            margin-bottom: 20px;
            border: 1px solid #f5c6cb;
            border-radius: 4px;
        }

        .message {
            background-color: #d4edda;
            color: #155724;
            padding: 15px;
            margin-bottom: 20px;
            border: 1px solid #c3e6cb;
            border-radius: 4px;
        }

        .back-btn {
            display: inline-block;
            padding: 10px 20px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            text-decoration: none;
            font-size: 16px;
            text-align: center;
            cursor: pointer;
            margin-top: 10px;
            transition: background-color 0.3s;
        }

        .back-btn:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>

<div class="container">
    <h1>找回密码</h1>
    <form action="/retrieve-password" method="post">
        <label for="email">注册邮箱：</label>
        <input type="email" id="email" name="email" required>

        <label for="password">新密码：</label>
        <input type="password" id="password" name="password" required>

        <label for="confirmPassword">确认密码：</label>
        <input type="password" id="confirmPassword" name="confirmPassword" required>

        <label for="securityQuestion">密保问题：</label>
        <select id="securityQuestion" name="securityQuestion" required>
            <option value="你的第一只宠物的名字是什么？">你的第一只宠物的名字是什么？</option>
            <option value="你的母亲的姓名是什么？">你的母亲的姓名是什么？</option>
            <option value="你就读的小学叫什么名字？">你就读的小学叫什么名字？</option>
        </select>

        <label for="securityAnswer">密保答案：</label>
        <input type="text" id="securityAnswer" name="securityAnswer" required>

        <button type="submit">重置密码</button>
    </form>

    <!-- 显示错误消息 -->
    <c:if test="${not empty error}">
        <div class="error">
                ${error}
        </div>
    </c:if>

    <!-- 显示其他消息 -->
    <c:if test="${not empty message}">
        <div class="message">
                ${message}
        </div>
    </c:if>

    <!-- 返回登录按钮 -->
    <button class="back-btn" onclick="window.location.href='/login.jsp'">返回登录</button>
</div>

</body>
</html>
